package com.luckymore.ydd.app.model;

import com.base.model.Bean2Json;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

public class MAppQuestion {

	static public class MQuestions extends Bean2Json<MQuestions> {
		private static final long serialVersionUID = 1L;
		private List<MQuestion> list = new ArrayList<MQuestion>();
		public List<MQuestion> getList() {
			return this.list;
		}
		public void setList(List<MQuestion> list) {
			this.list=list;
		}
		public MQuestions build() throws Exception {
			JSONArray jalist = data.getJSONArray("list_");
			for(int i = 0, len = jalist.length(); i < len; i++) {
				MQuestion n = new MQuestion();n.setData(jalist.getJSONObject(i));this.list.add(n);
			}
			return this;
		}
		public void build(Bean2Json data) {
			this.setList(((MQuestions)data).getList());
		}

	}

    @DatabaseTable(tableName="t_questions")
	static public class MQuestion extends Bean2Json<MQuestion> {
		private static final long serialVersionUID = 1L;
        @DatabaseField(id=true)
		private String id;
        @DatabaseField
        private String userid;
        @DatabaseField(defaultValue = "")
        private String img;
        @DatabaseField(defaultValue = "")
        private String remark;
        @DatabaseField
		private int type;
        @DatabaseField
        private String displayName;
        @DatabaseField
        private String subject;
        @DatabaseField
        private int isAd;
        @DatabaseField
        private int isHighlight;
        @DatabaseField
        private int isRecommend;
        @DatabaseField(defaultValue = "")
        private String lastTime;
        @DatabaseField(defaultValue = "")
        private String createTime;
        @DatabaseField(defaultValue = "")
        private String url;
        @DatabaseField
        private int hasLearned;
        @DatabaseField
        private int reviewCount;
        @DatabaseField
        private int isUploaded;
        @DatabaseField
        private String day;
        @DatabaseField
        private int status;
        @DatabaseField
        private String title;
        @DatabaseField
        private int orientation;
        private int isCollected;
		public String getId() {
			return this.id;
		}
		public void setId(String id) {
			this.id=id;
		}
		public String getUserid() {
			return this.userid;
		}
		public void setUserid(String userid) {
			this.userid=userid;
		}
		public String getImg() {
			return this.img;
		}
		public void setImg(String img) {
			this.img=img;
		}
		public String getRemark() {
			return this.remark;
		}
		public void setRemark(String remark) {
			this.remark=remark;
		}
		public int getType() {
			return this.type;
		}
		public void setType(int type) {
			this.type=type;
		}
		public String getDisplayName() {
			return this.displayName;
		}
		public void setDisplayName(String displayName) {
			this.displayName=displayName;
		}
		public String getSubject() {
			return this.subject;
		}
		public void setSubject(String subject) {
			this.subject=subject;
		}
		public int getIsAd() {
			return this.isAd;
		}
		public void setIsAd(int isAd) {
			this.isAd=isAd;
		}
		public int getIsHighlight() {
			return this.isHighlight;
		}
		public void setIsHighlight(int isHighlight) {
			this.isHighlight=isHighlight;
		}
		public int getIsRecommend() {
			return this.isRecommend;
		}
		public void setIsRecommend(int isRecommend) {
			this.isRecommend=isRecommend;
		}
		public String getLastTime() {
			return this.lastTime;
		}
		public void setLastTime(String lastTime) {
			this.lastTime=lastTime;
		}
		public String getCreateTime() {
			return this.createTime;
		}
		public void setCreateTime(String createTime) {
			this.createTime=createTime;
		}
		public String getUrl() {
			return this.url;
		}
		public void setUrl(String url) {
			this.url=url;
		}
		public int getHasLearned() {
			return this.hasLearned;
		}
		public void setHasLearned(int hasLearned) {
			this.hasLearned=hasLearned;
		}
		public int getReviewCount() {
			return this.reviewCount;
		}
		public void setReviewCount(int reviewCount) {
			this.reviewCount=reviewCount;
		}

        public int getIsCollected() {
            return isCollected;
        }

        public void setIsCollected(int isCollected) {
            this.isCollected = isCollected;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public String getDay() {
            return day;
        }

        public void setDay(String day) {
            this.day = day;
        }

        public int getIsUploaded() {
            return isUploaded;
        }

        public void setIsUploaded(int isUploaded) {
            this.isUploaded = isUploaded;
        }

        public int getOrientation() {
            return orientation;
        }

        public void setOrientation(int orientation) {
            this.orientation = orientation;
        }

        public MQuestion build() throws Exception {
			this.setId(data.getString("id_"));
			this.setUserid(data.getString("userid_"));
			this.setImg(data.getString("img_"));
			this.setRemark(data.getString("remark_"));
			this.setType(data.getInt("type_"));
			this.setDisplayName(data.getString("displayName_"));
			this.setSubject(data.getString("subject_"));
			this.setIsAd(data.getInt("isAd_"));
			this.setIsHighlight(data.getInt("isHighlight_"));
			this.setIsRecommend(data.getInt("isRecommend_"));
			this.setLastTime(data.getString("lastTime_"));
			this.setCreateTime(data.getString("createTime_"));
			this.setUrl(data.getString("url_"));
			this.setHasLearned(data.getInt("hasLearned_"));
			this.setReviewCount(data.getInt("reviewCount_"));
            this.setTitle(data.getString("title_"));
            this.setStatus(data.getInt("status_"));
			return this;
		}
		public void build(Bean2Json data) {
			this.setId(((MQuestion)data).getId());
			this.setUserid(((MQuestion)data).getUserid());
			this.setImg(((MQuestion)data).getImg());
			this.setRemark(((MQuestion)data).getRemark());
			this.setType(((MQuestion)data).getType());
			this.setDisplayName(((MQuestion)data).getDisplayName());
			this.setSubject(((MQuestion)data).getSubject());
			this.setIsAd(((MQuestion)data).getIsAd());
			this.setIsHighlight(((MQuestion)data).getIsHighlight());
			this.setIsRecommend(((MQuestion)data).getIsRecommend());
			this.setLastTime(((MQuestion)data).getLastTime());
			this.setCreateTime(((MQuestion)data).getCreateTime());
			this.setUrl(((MQuestion)data).getUrl());
			this.setHasLearned(((MQuestion)data).getHasLearned());
			this.setReviewCount(((MQuestion)data).getReviewCount());
            this.setIsUploaded(((MQuestion)data).getIsUploaded());
            this.setDay(((MQuestion)data).getDay());
            this.setStatus(((MQuestion)data).getStatus());
            this.setTitle(((MQuestion)data).getTitle());
            this.setIsCollected(((MQuestion)data).getIsCollected());
            this.setOrientation(((MQuestion)data).getOrientation());
		}

        @Override
        public String toString() {
            return "MQuestion{" +
                    "id='" + id + '\'' +
                    ", userid='" + userid + '\'' +
                    ", img='" + img + '\'' +
                    ", remark='" + remark + '\'' +
                    ", type=" + type +
                    ", displayName='" + displayName + '\'' +
                    ", subject='" + subject + '\'' +
                    ", isAd=" + isAd +
                    ", isHighlight=" + isHighlight +
                    ", isRecommend=" + isRecommend +
                    ", lastTime='" + lastTime + '\'' +
                    ", createTime='" + createTime + '\'' +
                    ", url='" + url + '\'' +
                    ", hasLearned=" + hasLearned +
                    ", reviewCount=" + reviewCount +
                    ", isUploaded=" + isUploaded +
                    ", day='" + day + '\'' +
                    '}';
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            MQuestion mQuestion = (MQuestion) o;

            if (!id.equals(mQuestion.id)) return false;

            return true;
        }

        @Override
        public int hashCode() {
            return id.hashCode();
        }
    }

	static public class MQuestionCount extends Bean2Json<MQuestionCount> {
		private static final long serialVersionUID = 1L;
		private int totoalCount;
		private int engCount;
		private int polityCount;
		private int mathCount;
		private int major1Count;
		private int major2Count;
		public int getTotoalCount() {
			return this.totoalCount;
		}
		public void setTotoalCount(int totoalCount) {
			this.totoalCount=totoalCount;
		}
		public int getEngCount() {
			return this.engCount;
		}
		public void setEngCount(int engCount) {
			this.engCount=engCount;
		}
		public int getPolityCount() {
			return this.polityCount;
		}
		public void setPolityCount(int polityCount) {
			this.polityCount=polityCount;
		}
		public int getMathCount() {
			return this.mathCount;
		}
		public void setMathCount(int mathCount) {
			this.mathCount=mathCount;
		}
		public int getMajor1Count() {
			return this.major1Count;
		}
		public void setMajor1Count(int major1Count) {
			this.major1Count=major1Count;
		}
		public int getMajor2Count() {
			return this.major2Count;
		}
		public void setMajor2Count(int major2Count) {
			this.major2Count=major2Count;
		}
		public MQuestionCount build() throws Exception {
			this.setTotoalCount(data.getInt("totoalCount_"));
			this.setEngCount(data.getInt("engCount_"));
			this.setPolityCount(data.getInt("polityCount_"));
			this.setMathCount(data.getInt("mathCount_"));
			this.setMajor1Count(data.getInt("major1Count_"));
			this.setMajor2Count(data.getInt("major2Count_"));
			return this;
		}
		public void build(Bean2Json data) {
			this.setTotoalCount(((MQuestionCount)data).getTotoalCount());
			this.setEngCount(((MQuestionCount)data).getEngCount());
			this.setPolityCount(((MQuestionCount)data).getPolityCount());
			this.setMathCount(((MQuestionCount)data).getMathCount());
			this.setMajor1Count(((MQuestionCount)data).getMajor1Count());
			this.setMajor2Count(((MQuestionCount)data).getMajor2Count());
		}

	}


}
